﻿import com.dinmax.isolution.*

class LightDimmerEditorGUI
extends DeviceEditorGUI {
	
	private var device:LightDimmer;
	private var listener:WindowDeviceGUI;
	
			
	public function getDevice():LightDimmer{
		return this.device;
	}
	public function setDevice(newDevice:LightDimmer):Void{
		super.setDevice(newDevice);
		return;
	}
		
	public function refresh():Void {
		
		super.refresh();
		
		var val:Number = this.device.getValue(true);
		if(val > 0) {
			this["mcState"].gotoAndStop(1);
			this["mcSlider"].mcSlider._visible = true;
		} else {
			this["mcState"].gotoAndStop(2);
			this["mcSlider"].mcSlider._visible = false;
		}
		
		this["mcSlider"]["txt_value"].text = Math.round(val)+"%";
		this["mcSlider"].mcSlider.gotoAndStop(Math.floor(val/10));
					
		return;
	}
	
}